package com.laomou.password;

import java.util.List;

import android.content.Context;

import com.laomou.password.ui.Password;
import com.rapida.db.SQLiteHelper;

public class WeiboPasswordHelper implements IPassword {
	private SQLiteHelper mLiteHelper;

    public WeiboPasswordHelper(Context context) {
        mLiteHelper = new SQLiteHelper(context, Password.class);
    }

    @Override
    public String getPackage() {
        return "com.sina.weibo.SwitchUser";
    }

    @Override
    public String getAccountId() {
        return "com.sina.weibo:id/etLoginUsername";
    }

    @Override
    public String getAccount() {
    	List<Password> list = mLiteHelper.findAll();
        for (Password psd : list) {
            if (getPackage().equals(psd.pkg)) {
                return psd.account;
            }
        }
        return null;
    }

    @Override
    public String getPassword() {
    	List<Password> list = mLiteHelper.findAll();
        for (Password psd : list) {
            if (getPackage().equals(psd.pkg)) {
                return psd.password;
            }
        }
        return null;
    }

    @Override
    public String getPasswordId() {
        return "com.sina.weibo:id/etPwd";
    }
}
